package interview;

import java.util.Arrays;
import java.util.Scanner;

public class anhen02 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] tree = new int[n];
        for (int i = 0; i < n; i++){
            tree[i] = in.nextInt();
        }
        int mid = n / 2;
        int lsum = 0;
        int rsum = 0;
        for (int i = 0; i < mid; i++){
            lsum += tree[i];
            rsum += tree[mid + i + 1];
        }
        int sum = lsum * rsum + tree[mid];
        int[] arr1 = new int[mid];
        int[] arr2 = new int[n - mid - 1];
        for (int i = 0; i < mid; i++){
            arr1[i] = i + 1;
        }
        for (int i = 0; i < arr2.length; i++){
            arr2[i] = mid + i + 1;
        }

        int index = 1;
        int[] arr = new int[n];
        arr[0] = mid + 1;
        for (int i : arr1) {
            arr[index++] = i;
        }
        for (int i : arr2) {
            arr[index++] = i;
        }

        System.out.println(sum);
        System.out.println(Arrays.toString(arr));
    }
}
